package com.graduate.utils;

/**
 * @description: String字符串相关工具包
 * @author: JingChu
 * @createtime :2021-06-06 09:05:08
 **/
public class StringUtils {
    /**
     * 空字符串
     */
    private static String emptyString = "";
    /**
     * null字符串
     */
    private static String nullString = "null";

    /**
     * 判断字符串是否为空，为空则返回true
     *
     * @param str
     * @return boolean
     */
    public static boolean isEmptyOrNull(String str) {
        str = clearblank(str);
        return (null == str || emptyString.equals(str.trim()) || nullString.equals(str.toLowerCase()));
    }

    /**
     * 清除字符串中的空格、tab、回车、制表符
     *
     * @param str
     * @return String
     */
    public static String clearblank(String str) {
        return str.replaceAll(" |\t|\n|\f|\r", "");

    }
}
